Method and apparatus for a trace buffer in an emulation system

ABSTRACT

A tracing method and apparatus for a digital emulation system. The invention allows trace information to be obtained during the emulation of a digital circuit that includes a clock signal. Input signal states are sensed and stored each clock cycle. The internal state of the emulated digital circuit is also stored. By using the stored input signal states and internal states, the states of other signals in the emulated digital circuit are derived.

This application is a Continued Prosecution application of Ser. No. 08/855,908 filed on May 13, 1997, which is a continuation of Ser. No. 08/197,430 filed Feb. 16, 1994 now U.S. Pat. No. 5,680,563.

FIELD OF THE INVENTION

This invention relates generally to digital emulation systems and specifically to the use of trace buffers in digital emulation systems.

BACKGROUND OF THE INVENTION

Emulation systems typically use a computer, or other digital system, to simulate, or "emulate", a digital circuit being designed or developed. The emulation system is designed to mimic the logical operation of the digital circuit. This means that the signal inputs given to the emulator will result in the emulator outputing signals identical to that which would be output when the emulated circuit is given the same input signals.

During emulation, a trace buffer is used as an aid in analyzing and debugging the circuit under development. The trace buffer stores a record of changing states of signal inputs, signal outputs and internal signals of the circuit being emulated. In a digital synchronous system the states are stored once per clock cycle. The use of a trace buffer allows the circuit designer to emulate the circuit under development and operate the circuit up to a point where an error condition occurs. The trace buffer may continue to collect signal states but at some point tracing is stopped to allow the human designer to examine the record of signal states to determine what events caused the error. Alternatively, the operation of the circuit may be permitted to continue past the error condition so that the designer has a record of events that occur after the error condition. In this way, the record of signal states provided by the trace buffer aids the designer in developing a digital circuit. Emulation methods in use today provide other analytical tools to aid the designer in debugging the circuit.

A problem arises in traditional emulation methods where the size and speed of the digital circuit being designed introduces problems of efficiency and accuracy in emulating the circuit.

In order for a circuit under design to be accurately emulated the emulation of the circuit must run at, or close to, the circuit's target operating speed. This is because the circuit being emulated must often interface with external circuitry operating at real time speeds. Also, certain problems in the design of the circuit may only be apparent when the emulation is run at target operating speeds.

An emulation method in use today uses field programmable gate arrays (FPGAs) to emulate a circuit. With this method, a logic description of the circuit is prepared by the designer. The logic description is input to a compiler that determines how to implement the logic description in the FPGAs. Assuming two or more FPGAs are used the design is broken down into subsystems where each subsystem can be implemented on one of the FPGAs. This step is critical since the number of pins on an FPGA package often restricts the types of signals that can later be traced. For example, typical numbers of input/output (I/O) pins available on an FPGA package range from 64 to 144. Invariably these pins are in short supply because of interfacing requirements for the FPGA. This causes problems when the designer must decide which signals internal to the FPGA to make available on I/O pins so that the signals can be traced during emulation.

Once a trace has been performed, the signals in the trace buffer, corresponding to signals in the compiled FPGA circuits, are correlated to signals in the original circuit under development.

A circuit may also be emulated in a computer system. The computer system may be a general purpose computer or a dedicated computer system whose architecture is designed especially for emulating complex digital circuits. In general, for a general purpose computer, the circuit emulation is carried out mostly by software. For a dedicated computer system, the more specialized the architecture, the more the circuit design is emulated by the hardware rather than software. In either computer emulation system, the problems of specifying which signals to trace and correlating the traced signals to signals in the original design still exist.

An additional problem where substantial portions of the emulation are accomplished via software is that the emulation is very slow compared to the target operating speed of the circuit. Tracing, or capturing signal states, will often be performed by software. However, this has the drawback that the emulation is slowed down even more. Where tracing is done substantially by hardware the size of the trace buffer limits the number of signals that may be traced and the number of clock cycles during which a signal may be traced in any given emulation run.

The emulation, tracing and correlation steps may be repeated many times while the designer attempts to isolate and solve a problem with the circuit design. Often, the designer must make a choice as to which signals to trace at any given emulation run. If it turns out that not all of the necessary signals have been traced the designer must go back and perform another trace that may involve manually connecting and disconnecting signal paths to, e.g., an external logic analyzer, in order to capture the missing signal. Even more burdensome where FPGAs are used, a signal that the designer is interested in may not be provided on an FPGA pin. In this case, the designer must go back to the compile step in order to specify that the desired signal must be connected to an FPGA pin. Each repetition of the compiling, emulating, tracing and correlating steps adds to the development time of the circuit and increases the cost. Therefore, a system is needed which eliminates the problems of the emulation systems described above.

SUMMARY OF THE INVENTION

The present invention overcomes the problems of the prior art as discussed above.

The present invention provides tracing system for tracing the operation of a digital circuit wherein the digital circuit includes storage elements such as flipflops, registers and memory. The tracing system includes a digital system for emulating the operation of a digital circuit; means for representing the digital circuit within the digital system; input tracing means for sensing and storing the states of the inputs of the digital circuit every clock cycle; state tracing means for sensing and storing the states of storage elements every n clock cycles; analysis means coupled to the digital system for deriving the state of one or more internal signals based on the stored internal states and the stored input states and output means for outputing the states of the internal signals.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram showing the basic steps in emulating and tracing a circuit design;

FIG. 2A shows a simple binary counter used as an example to illustrate the operation of the present invention;

FIG. 2B shows an implementation of the circuit of FIG. 2A;

FIG. 3A illustrates a first implementation of a circuit design in an emulation system;

FIG. 3B illustrates a second implementation of a circuit design in an emulation system;

FIG. 3C is a block diagram of a multiprocessor array capable of a third implementation of a circuit design in an emulation system;

FIG. 3D is a more detailed block diagram of some of the subsystems of the multiprocessor array of FIG. 3C;

FIG. 4 shows a flowchart for a routine that performs sensing and storing of trace information in the present invention;

FIG. 5A is a timing diagram of signals in the circuit of FIG. 2A; and

FIG. 5B is an illustration of a trace buffer that contains the states of signals in FIG. 5A.

DETAILED DESCRIPTION OF A PREFERRED EMBODIMENT

FIG. 1 is a block diagram showing the basic steps in emulating and tracing a circuit design. In FIG. 1, basic steps 102, 106, 110 and 116 are part of a design/debugging process 100 with which the trace method and apparatus of the present invention is used.

At step 102 of FIG. 1, the circuit design is first created by a human designer. This is typically a schematic diagram of the circuit in either electronic or printed form. The circuit may be designed for fabrication, ultimately, on a printed circuit board with discrete components, on a single integrated circuit chip, etc. File 104 is an electronic representation of the circuit design description. This may include a record of components and interconnections (i.e., a netlist). At step 106, the circuit design is implemented in a digital system. The digital system can be one or more FPGAs, a breadboard design, a general purpose computer, custom multiprocessor array, etc.

A typical way to implement circuit design description 104 in a digital system is to compile the circuit design into compiled design description 108. Compiled design description 108 describes a circuit that performs the same logic functions as circuit design description 104, with respect to the inputs and outputs of circuit design description 104, but usually implements the logic functions in a different way as dictated by the constraints of the digital system being used for the emulation. An example would be where a circuit design description is compiled to be implemented on one or more FPGAs. A circuit design description can also be compiled to be implemented on a general purpose digital computer. In a preferred embodiment, the present invention uses a circuit design description that is compiled to execute on a custom multiprocessor array. Any suitable implementation of the circuit design into an emulation system is within the scope of the present invention.

At step 110 of FIG. 1, the implemented circuit design is emulated by operating the digital system. During emulation, trace information is obtained and used to create trace information file 112. Traditionally, the human designer makes decisions as to which signals to trace. The designer would often be limited in the number of signals that could be traced, both by the digital system performing the emulation and by the tracing system. Also, the decision as to which signals to trace can require considerable thought and, where custom hardware devices such as FPGAs or application specific integrated circuits (ASICs) are used to implement the circuit design, the physical connections required to set up the trace are time-consuming. The present invention, as described below, eliminates these tasks from the designer's work thereby providing a more efficient tracing mechanism.

Box 114 of FIG. 1 is the automated step in which the circuit design description 104, compiled design description 108 and trace information 112 files are processed to provide results in human-readable form to the designer. Trace information file 112 contains the state of selected signals in the emulated circuit during operation of the circuit at step 110. By using the traced states, these signals are related to signals in the compiled design description 108. By working "backwards" from the compiled design description, the signal states are, in turn, related to signals in circuit design description 104. Thus, the designer is presented with signal states at various nodes within the circuit according to the designer's original circuit design. This conveniently relates signal states in the emulation to the circuit design that the designer is most familiar with.

At step 116, the designer analyzes the trace results. Step 102 is again performed in order to make any necessary changes to the circuit design to correct for errors and steps 106, 110, 116 and 102 are repeated until the design is working properly. Thus, FIG. 1 illustrates the basic steps of design/debugging process 100 used by the designer to design and debug a digital circuit with the aid of a circuit emulator and a tracing system.

Next, FIG. 2A is discussed as a specific example of a circuit design that is emulated and traced using the system of the present invention.

In FIG. 2A, circuit design 120 is shown. Circuit design 120 is a simple binary counter of 4 bits in width. The most significant bit of the counter is the output of D-flipflop I15 labeled OUTPUT. Inputs to circuit design 120 are COUNT and RESET and a system clock, CLOCK, is provided. Circuit design 120 has four D-flipflops labeled I58, I36, I27 and I15. The outputs of the D-flipflops are, respectively, N83, N101, N106 and OUTPUT. Combinatorial logic is shown to the left of the D-flipflops as an interconnection of discrete gates.

Circuit design 120 of FIG. 2A is a very simple circuit used here to illustrate the tracing system of the present invention. In practice, the present invention would be used in the emulation and tracing of a circuit containing thousands or tens of thousands of gates and storage elements such as latches, flip-flops, registers and memory devices. The present invention simplifies tracing a circuit by storing the states of the inputs to the circuit every clock cycle and by storing the circuit's "internal state" every clock cycle or intermittently, that is, less than every clock cycle. The internal state of the circuit includes the states of the inputs and any storage devices in the circuit. By storing the states of the inputs and the storage devices all of the other signal states in the circuit can be derived from the stored states since the other states are combinatorially generated from the stored states. Alternatively, a subset of the internal state of the circuit could be stored when it is not desired to derive every possible signal state in the circuit.

One way to store the internal state of the circuit (assuming, as here, that the inputs are also being stored) is to store the states of all of the outputs of all storage devices in the circuit. Another way to store the internal state is to store all of the inputs to the storage devices at the time they are clocked into the devices. It is also possible to store the internal state by storing less than all of the states of the storage devices if the states of the unstored storage devices can be derived from the known, stored states. Other ways of storing the internal state of the circuit are possible.

In the case of the circuit of FIG. 2A, the internal state of the circuit is determined by the states of the outputs of the D-flipflops. These are the signals at N83, N101, N106 and OUTPUT. Since, as discussed above, there are many different ways to implement a circuit design in an emulation system it is necessary to ensure that the implementation allows for the internal state of the circuit to be determined in order to practice the present invention. Further, the present invention requires that the states of the inputs be determined at every clock cycle. This latter requirement of sensing the inputs to the circuit every clock cycle is easily satisfied since inputs to the emulated circuit are typically provided by an outside source that can also be connected to the tracing system.

FIGS. 3A-D illustrate three different implementations of the circuit design of FIG. 2A. In each implementation the tracing system of the present invention must be able to sense and store the state of the inputs at every clock cycle and store the internal state of the implementation at least intermittently. These implementations are representative of many possible implementations that may be used with the tracing scheme of the present invention. In general, as long as the requirements of sensing the inputs and internal state are satisfied any implementation is adequate for use in connection with the invention.

FIG. 3A shows the implementation of circuit design 120 of FIG. 2A in a general purpose computer. In FIG. 3A computer system 160 includes CPU 162, I/O 164 and memory 166 interconnected by a bus 168. Memory 166 is shown containing program code and data. These components form a "digital system" suitable for emulating the circuit design. The circuit design 120 of FIG. 2A is implemented within computer system 160 by software residing within memory 166. The software is executed by CPU 162. Inputs and outputs are through I/O port 164. Other computer system configurations are possible.

In FIG. 3A, program 170 includes a description of the logic functions in circuit design 120. Program 170 is a combination of executable code and data that defines the logic functions of circuit design 120. Trace buffer 172 is a portion of memory that is used to store state information generated by the execution of program 170 by CPU 162. Memory locations 174 are four specific locations used to store the state of each of the D-flipflops in circuit design 120. Thus, the state of the signal, OUTPUT, for D-flipflop I58 is shown to be 0. The states for I36, I27 and I15 are, respectively, 1, 1 and 0. During the course of emulating circuit design 120, locations 174 are updated with the current state of the D-flipflops. The contents of locations 174 are copied into trace buffer 172 as needed by the tracing system. Code for accomplishing the copying resides in memory 166 and can be part of program 170. The states of the input signals COUNT and RESET may be sensed by having the CPU read I/O port 164 and storing the status of the bits in I/O port 164 in trace buffer 172 in a manner that is commonly known in the art.

Thus, the implementation of circuit design 120 in a general purpose computing system as shown in FIG. 3A provides for tracing both the states of the inputs and the internal state of the circuit as required by the tracing system of the present invention.

FIG. 3B shows an implementation of circuit design 120 in FPGAs. Normally, a circuit as simple as circuit design 120 would simply be formed on a breadboard for further testing. However, for purposes of illustration we show circuit design 120 implemented into simplified FPGAs as shown in FIG. 3B. Each FPGA has inputs and a clock shown as COUNT, RESET and CLOCK. There are two signals arranged vertically between the top and bottom FPGA for a total of five interconnections in each FPGA. The top FPGA has outputs N83 and N101. These outputs correspond to the nodes shown in FIG. 2A of the same name. Bottom FPGA has outputs N106 and OUTPUT. These correspond to the node and output in FIG. 2A of the same name.

Each FPGA implements roughly half of circuit design 120. The gate arrangements and interconnections within the FPGAs need not be identical with those shown in circuit design 120; however, the logical functions implemented in the FPGAs will be identical to those of circuit design 120 with respect to the inputs and output of the circuit.

As can be seen from FIG. 3B, the implementation makes the inputs, namely, CLOCK, COUNT and RESET, available at every clock cycle. Also, the internal state of the circuit is available since each of the D-flipflop outputs are provided on pins N83, N101, N106 and OUTPUT.

FIGS. 3C and 3D show portions of a chip used in a custom multiprocessor array capable of another implementation of circuit design 120. FIG. 3C shows the basic subsystems of the multiprocessor array architecture as blocks. In a preferred embodiment, the circuit of FIG. 3C is fabricated on a single chip and multiple chips may be arranged into a larger multiprocessor array. Signal paths to the trace buffer or random access memory (RAM) are also shown. FIG. 3D is a more detailed block diagram of some of the subsystems of FIG. 3C, including the tracing connections.

In FIG. 3C, multiprocessor array 300 includes control RAM, such as control RAM 302, for controlling the operation of processing subsystems in the array such as processing subsystem 304. The logic of a circuit design being emulated is computed by a processor group using local storage as shown by blocks within processing subsystem 304. Multiprocessor array 300 uses an emulation clock generated by sequencer 306 and a load signal derived from the clock by divider 308. Both the emulation clock and the load signal are used to capture trace information as described below.

As the circuit design is emulated by the processor subsystems, trace information is saved according to the present invention. That is, storage devices in the circuit design are emulated and their states are sampled and saved by providing the state information at pads 312 which are connected to an external trace RAM (not shown). In addition to the storage device states, the inputs used by the multiprocessor array are stored in the external trace RAM as shown by the signal paths from pads 310 to pads 312. Some components and connections have been omitted from FIG. 3C for ease of explanation. Notably, there are additional components and signal paths for allowing the signal inputs at 310 to be used as inputs to the multiprocessor array that are not shown in FIG. 3C.

FIG. 3D shows more details of processing subsystem 304, in FIG. 3C. As with FIG. 3C, FIG. 3D omits structure and interconnections that are not directly relevant to the present invention. In FIG. 3D, the processor group is at 314 while local storage and control, along with tracing components, is shown at 316. Each processing subsystem includes four shift registers such as shift registers 318, 320, 322 and 324. Each shift register is configured similarly.

For example, shift register 318 has its serial input connected to the processor group hardware so that it can receive information about the internal state of the circuit design being emulated (or, equivalently, the state of processing components in the multiprocessor array) as a single bit of information. The state information is stored under the control of signals generated by the control RAM. The control RAM outputs signals according to data words stored within it. The data is predetermined at a compile step in order to accurately emulate the circuit design. The designer can alter parameters at the compile step so that the type and frequency of state information that is loaded into shift registers such as 318, 320, 322 and 324 is adjustable.

Shift registers 318, 320, 322 and 324 are clocked by the system clock cycle. Thus, the registers contain the logic level of the processor outputs in the previous 8 clock cycles. The 8 to 1 multiplexers, such as multiplexer 326, allow selection of the appropriate bit. This differs somewhat from typical computer architecture designs where both storing and retrieving intermediate results is done selectively. By storing all information, at least for a limited time, fewer control signals are required.

Once state information is in the shift register it may be re-routed to the processor group via multiplexer 326, again under the control of signals from the control RAM. At predetermined times, the state information in the shift registers is loaded into an 8-bit parallel in/serial out shift register (referred to here as a "parallel in shift register"). For example, FIG. 3D shows that the state information in shift register 318 is loaded into parallel in shift register 328 according to load signal 330. Once a parallel in shift register is loaded, the state information is shifted out according to shift signal 332.

Note that all parallel in shift registers in FIG. 3D are cascaded so that they, in effect, form a 32 bit parallel in/serial out shift register that feeds to an output pad to the trace RAM. In a preferred embodiment, the parallel in shift registers are loaded every 32 emulated clock cycles and their data is shifted each emulated clock cycle. Therefore, since the components of FIG. 3D are duplicated four times, one for each processing subsystem of FIG. 3C, four bits of trace data are available each emulated clock cycle at the four pads shown at 312 of FIG. 3C connected to the processing groups. The trace information is also stored each emulated clock cycle so that the four bits of trace data are stored along with four bits of input signal data from the emulator inputs at pads at 310 in FIG. 3C.

Thus, FIGS. 3C and 3D illustrate how tracing of the internal state of a circuit design according to the specialized architecture of multiprocessor array 300 is achieved.

In each of the three implementations discussed above, the circuit design of FIG. 2A is changed as necessitated by the implementation. The implemented circuit may not have all of the signals and nodes that are present in the circuit design. Additional signals and nodes not present in the circuit design may also be present in the implemented circuit.

To illustrate this, FIG. 2B shows an implementation 130 of the circuit of FIG. 2A. In FIG. 2B, combinatorial gates at 132 duplicate the logic of combinatorial gates at 122 in circuit design 120 of FIG. 2A. Note that while nodes N52, N42, N33, N16, N83, N101, N106 and OUTPUT are preserved in implementation 130, certain nodes in circuit design 120 such as N77, N79, etc., are omitted from implementation 130. Even though the schematic diagrams for circuit design 120 and implementation 130 differ, both accomplish the same logical functions and for most emulation purposes are therefore identical.

Even though three specific implementation methods for emulating the circuit design of FIG. 2A have been shown with respect to the discussion corresponding with FIGS. 3A, 3B and 3C, any implementation scheme which allows for the inputs to be sensed every clock cycle and that allows for the internal state of the circuit to be sensed intermittently during the emulation is suitable for operation with the present invention as discussed below.

FIG. 4 shows a flowchart 200 for a routine that performs sensing and storing of trace information in the present invention.

All flowcharts presented in this application are but illustrative of the broad logical flow of steps performed in the invention. The flowchart may be implemented by a combination of hardware and software of which many different configurations and types are possible. Where software is used many computer languages as are commonly known in the art may be employed. In some embodiments, additional steps may be included to those steps illustrated by the flowcharts. Alternatively, steps may be omitted from the flowcharts without departing from the scope of the invention. The flowcharts may be implemented as one or more routines, modules, subroutines, etc. For ease of discussion, the flowchart will be referred to as being implemented by a single routine.

Prior to invoking or entering flowchart 200 at step 202, the variable "n₋₋ clocks" is set to 0 and an integer value is assigned to the variable "n". In a preferred embodiment, n is set to 32.

After the routine of flowchart 200 is entered at step 202, execution proceeds to step 204 where a test is made as to whether a new clock cycle has begun. This is determined by sensing the state of signal 309 of FIG. 3C. If it is not the start of a new clock cycle, execution returns to step 204 so that, in effect, processing remains at step 204 until the next clock cycle begins. Assuming the start of a new clock cycle, execution proceeds to step 206 where the states of the input signals are stored in the trace buffer. Next, step 208 is executed where a test is made as to whether n₋₋ clocks is an integral multiple of the value n. The first time that step 208 is executed, the value of n₋₋ clocks, as described above, is RESET to 0 so that n₋₋ clocks is an integral multiple of n, the integer being 0, so that execution proceeds to step 210.

At step 210, all of the internal states of the circuitry are stored in the trace buffer. Step 212 is next executed.

At step 212, the value of n₋₋ clocks is incremented. Step 214 is next executed which checks whether the trace has been completed. The criterion for determining the trace complete may be the execution of a break point, the detection of a predetermined value on a number of trace inputs, etc. Usually, this condition is determined by the designer who is performing the trace. Assuming the trace is not complete, execution continues at step 204 where the beginning of the next clock cycle is awaited.

The second time through the loop of steps 204-214 n₋₋ clocks has the value 1 since it was incremented at step 212. Once the next clock cycle begins, execution proceeds to step 206 where the input signal states are again stored in the trace buffer. At step 208 the value of n₋₋ clocks is compared with the value of n to determine whether n₋₋ clocks is an integral multiple of the value n. Since n₋₋ clocks now=1 and n remains 32, this condition is no longer true so execution proceeds to step 212 where the value of n₋₋ clocks is incremented again. Note that step 210, the step of storing all the internal states in the trace buffer, has been skipped. Thus, the internal states are only stored once every n clock cycles. Execution proceeds to step 214 where the loop of steps 204-214 is continued until the trace is complete. Once the trace is complete, the routine of flowchart 200 exits at step 216.

From the above discussion of the flowchart 200 of FIG. 4, it is apparent that the input signal states are stored every clock cycle while the internal states are stored in the trace buffer every n clock cycles.

FIG. 5A is a timing diagram showing signals in the circuit design 120 of FIG. 2A. FIG. 5A shows signals that must be provided to the tracing system of the present invention. Thus, signals CLOCK, COUNT, RESET, N83, N101, N106 and OUTPUT are all provided to the tracing system to allow the tracing system to sense the inputs and the internal state of circuit design 120 as needed.

The following discussion follows the method presented by the flowchart of FIG. 4 as discussed above. The implementation of the circuit of FIG. 2A in an emulation is ignored. That is, it is assumed that the nodes of FIG. 2A are mapped to nodes in an implemented circuit so that the states of the nodes can be sampled.

As seen in FIG. 5A, signal CLOCK is a square wave whose leading edge serves to activate the D-flipflops in the circuit 120 of FIG. 2A. In the timing diagram of FIG. 5A, n₋₋ clocks has the value as shown by the numbers beneath each clock cycle in the row labeled n-clocks. The value n is set to 4 throughout this discussion. The input states are shown below clock cycles as, for example, the first input state at CLOCK 0 of 01. Internal states are similarly shown as, for example, 0010 corresponding to CLOCK 3.

Beginning with the signals as shown in FIG. 5A at CLOCK 0, the method of flowchart 200 of FIG. 4 causes the input states to be stored in the trace buffer according to step 206. In a preferred embodiment, the test at step 208 of FIG. 4 is implemented by having n₋₋ clocks be a modulo n counter that is incremented once every clock cycle. So, for this example, the test at step 208 is true whenever n₋₋ clocks reaches the value 4. At this point, since n₋₋ clocks=1, the test fails so the internal state is not stored.

FIG. 5B is a table showing state values corresponding to the timing diagram of FIG. 5A. Note that for CLOCK 0, n₋₋ clocks=1, the input states are 01 and the input to the trace buffer is 01. The value 01 for the input states indicates that the COUNT signal is low and the RESET signal is high. In other words, the first digit of the input state is the state of the COUNT signal for the clock and the second, or least significant digit, is the state of the RESET signal for the same clock. The internal state is shown as 0000 but, since the internal state is not stored at this clock cycle the temporary buffer is empty and does not reflect this.

In a preferred embodiment, the temporary buffer is the parallel-in shift register chain as discussed above in connection with FIG. 3D. The use of the temporary buffer is explained below.

The next two clock cycles, where n₋₋ clocks is incremented to 2 and 3, proceed similarly as with the first clock cycle, CLOCK 0, where n₋₋ clocks=1, in that only the input state is stored in the trace buffer. When n₋₋ clocks=4 at CLOCK 3 the test at step 208 returns true because n₋₋ clocks=n. The value of n₋₋ clocks is reset to 0 and the internal state of the circuit is stored.

Step 210 is executed to store the internal state. As shown in the table of FIG. 5B, the internal state 0010 is stored in the temporary buffer. The internal state relates to the states of OUTPUT, N106, N101 and N83, in the order of most significant bit to least significant bit. The states are sampled sometime between the active clock cycle edges.

For n₋₋ clocks=1, 2 and 3, the result of step 208 of FIG. 4 is to bypass step 210 since these values of n₋₋ clocks are not an integer multiple of 4, the value of n. Thus, only the input states are stored in the trace buffer as shown in FIG. 5B at locations of the trace buffer corresponding to clocks 0, 1 and 2.

At CLOCK 3, n₋₋ clocks=4 and the internal state is stored in a temporary buffer. Also at CLOCK 3, the input state 10 and the first, or most significant bit, of the internal state 0010 is stored in the trace buffer. Only one bit, the most significant bit, of the internal state is stored as the least significant bit in the trace buffer entry. Thus, the system is using the shift register scheme described above in connection with FIG. 3D where once the internal state has been stored the bits of the internal state are shifted out serially for storage in the trace buffer. The trace buffer entry for CLOCK 4 is 100 which includes the input state 10 followed by the most significant bit of the internal state, or 0.

For clocks 4, 5 and 6, successive bits of the internal state 0010 are shifted out and stored in the trace buffer along with the bits from the input state. The temporary buffer entries in the table of FIG. 5B illustrate the bits being shifted out. At CLOCK 7, n₋₋ clocks again equals 4 and is reset to 0 while the internal state is stored in the temporary buffer so that successive shifting out of the new internal state bits can continue. Thus, each clock cycle, after an initial start up of 3 clock cycles, 3 bits are stored in the trace buffer. The most significant first two bits are the input state while the least significant bit is 1/4 of the internal state. This provides sufficient information in the trace buffer to allow the derivation of the state of all of the signals in the circuit according to the present invention.

This trace buffer system provides a distinct space savings over other systems. Only 3 bits per cycle are stored in the steady state operation of the buffer as compared to 6 bits were the internal state and input state to be stored each cycle. Thus, a trace buffer savings of 50% is realized. Greater savings can be realized depending on the frequency of storing the internal state. The more often the internal state is stored, the easier it is to calculate derivative signals in the circuit being simulated.

The tracing system can provide the state of any of the signals stored in the trace buffer of FIG. 5B by simply outputing them to the designer. For example, the state of the output at CLOCK 7 is determined to be 0 by consulting the internal state that was stored at that clock cycle. Each input signal's state is known at each clock cycle by looking at either of the two bits for that trace buffer entry. Internal state values may have to be mapped to find the value since the internal state value is spread out over four trace buffer entries. By performing this mapping of state values to trace buffer entries, the state of any input signal or internal state that was explicitly stored can be determined.

For signal states that aren't explicitly stored in the trace buffer, such as the state of the OUTPUT signal for CLOCK 6, the tracing system derives the value of OUTPUT based on the information stored in the trace buffer.

In order to derive the state of the OUTPUT signal, the tracing system goes back to the last stored internal states. This is at CLOCK 3 which maps to subsequent trace buffer locations having the values 100, 100, 101 and 100. Thus the internal state stored for CLOCK 3 is 0010. Three clock cycles, namely, clocks 4, 5 and 6, must be stepped through in order to reach CLOCK 6 which is the clock cycle for which the state of the OUTPUT signal is sought.

For each of clock cycles 4, 5 and 6, COUNT is high and RESET is low. This information is obtained from the input states stored in the trace buffer. Referring to FIG. 2A, circuit 120 has a three-input NAND gate I64 whose inputs are connected to N83, N101 and N106. These outputs of the D-flipflops are known to be, respectively, 0, 1 and 0 since these states were stored at CLOCK 3. Since not all of the inputs to NAND gate I64 are high, the output at N67 is high.

The output at N67 is the input to exclusive OR gate I62. The other input to I62 is the signal OUTPUT. OUTPUT is known to be 0 from the stored internal state at CLOCK 3. Thus, the OUTPUT of I62 at N81 is high.

The inputs to I1, a two-input AND gate are both high since COUNT is high according to the stored input states for CLOCK 4. Thus, the output of I1 at N11 is high. The inputs to I2, a two-input NOR gate are COUNT and OUTPUT. The states of COUNT and OUTPUT are stored in the trace buffer. Thus, it is known that one of the inputs to NOR gate I2 is high while the other is low. Therefore, the output of the NOR gate at N13 is low.

The inputs to three-input NOR gate I4 are high, low and low. Thus, the output of I4, at N16 is low. Since N16 is the input to the D-flipflop I15, the output of I15 upon the next clock cycle will be low.

In a similar manner, the states of the remaining D-flipflops at N83, N101 and N106 can be determined. This yields an internal state of 0011 for CLOCK 4.

After deriving the internal states for CLOCK 4, a similar process can be used to generate the internal states for clocks 5 and 6. This gives 0100 as the internal state for CLOCK 5 and 0101 as the internal state for CLOCK 6. Since the most significant bit of the internal state is the OUTPUT signal, the OUTPUT signal has been determined to be 0 at CLOCK 6 and the required information is presented to the designer. Even though this internal state was not stored during the trace operation described above, it has been derived. Thus, it is shown that states for signals that have not been stored in the trace buffer can be derived from the signal states and intermittently stored internal state.

It has been shown that storing the internal states intermittently conserves trace buffer storage. The tradeoff is that it takes time to derive internal states that were not stored. The time to derive internal states in emulations where the circuit design has a large number of gates can be prohibitive, resulting in a delay before results can be provided to the designer. In a preferred embodiment, the trace buffer is 32 kilobytes in size. The value n, is set to 32.

The internal state of the circuit design can be stored without storing the outputs of each storage element as long as enough information is stored to determine the complete state of the circuit. As an example, for circuit design 120 of FIG. 2A, the internal state of the circuit is known if it is known that RESET is high since this puts each D-flipflop into a reset state where the output of each D-flipflop is 0. Another example is that the signal, OUTPUT, of D-flipflop I15 can be determined by storing the state of a signal derived from OUTPUT, such as the signal at node N81. If the output of D-flipflop I27 (at N106) is known to be, e.g., 0, and N81 is sensed and stored as a 1, then OUTPUT must be a 0 to satisfy the logical constraints of NAND gate I64 coupled to exclusive-OR gate I62. Other ways of storing the internal state of a circuit rather than storing the states of each of the circuit's storage elements are possible.

In the foregoing specification, the invention has been described with reference to a specific exemplary embodiment thereof. It will, however, be evident that various modifications and changes may be made thereunto without departing from the broader spirit and scope of the invention as set forth in the appended claims. For example, various programming languages and techniques can be used to implement the disclosed invention. Also, the specific logic presented to accomplish tasks within the present invention may be modified without departing from the scope of the invention. Many such changes or modifications will be readily apparent to one of ordinary skill in the art. The specification and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense, the invention being limited only by the provided claims. 

What is claimed is:
 1. A tracing system for tracing the operation of a digital circuit, the tracing system comprising:a digital system for emulating the operation of the digital circuit, the digital system including a clock, inputs, internal signals and one or more state storage means for storing and indicating an electrical state; implementation means coupled to the digital system for representing the logic of the digital circuit within the digital system; input tracing means coupled to the digital system for sensing and storing the states of the inputs every clock cycle; internal state tracing means coupled to the storage means in the digital system, for sensing and storing a state of a state storage means of the digital system every n clock cycles; analysis means coupled to the digital system for deriving the state of one or more internal signals based on the stored internal states and the stored input states; and output means coupled to the digital system for outputing the derived states of the internal signals.
 2. The tracing system of claim 1, wherein the internal state tracing means senses and stores the internal state of the digital system by storing one or more internal signal states, wherein the signal states collectively determine the state of each of the storage elements in the digital circuit.
 3. The tracing system of claim 1, wherein the digital system is two or more field programmable gate arrays.
 4. The tracing system of claim 1, wherein the digital system is a general purpose computer executing software.
 5. The tracing system of claim 1, wherein the digital system is a multiprocessor array.
 6. The tracing system of claim 1, wherein the implementation means includes compiling the digital circuit design into a compiled design including one or more boolean logic definitions.
 7. The tracing system of claim 6, wherein the analysis means uses the representation of the logic of the digital circuit within the digital system, the compiled design, the stored input states and the stored internal states to derive trace information. 